using System;
using System.Collections.Generic;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media.Imaging;
namespace Coding4Fun.Phone.Controls.Converters
{
	public class ThemedImageConverter : IValueConverter
	{
		private static readonly Dictionary<string, BitmapImage> dictionary_0 = new Dictionary<string, BitmapImage>();
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			bool flag = Application.get_Current().get_Resources().Contains("PhoneDarkThemeVisibility") && (Visibility)Application.get_Current().get_Resources().get_Item("PhoneDarkThemeVisibility") == 0;
			BitmapImage bitmapImage = null;
			string text = value as string;
			if (text != null)
			{
				string text2 = string.Format(text, flag ? "dark" : "light");
				if (!ThemedImageConverter.dictionary_0.TryGetValue(text2, ref bitmapImage))
				{
					bitmapImage = new BitmapImage(new Uri(text2, 2));
					ThemedImageConverter.dictionary_0.Add(text2, bitmapImage);
				}
			}
			return bitmapImage;
		}
		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			throw new NotImplementedException();
		}
	}
}
